package com.jml.fallback;

import com.jml.bean.Depart;
import com.jml.service.DepartService;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Component
@RequestMapping("/fallback/consumer/depart")//这样写可以规避springmvc的一个bug，这个注解没有任何的意义
public class DepartServiceFallback implements DepartService {
    @Override
    public boolean saveDepart(Depart depart) {
        System.out.println("执行feignsaveDepart()的服务降级处理方法");
        return false;
    }

    @Override
    public boolean delDepartById(int id) {
        System.out.println("执行feigndelDepartById()的服务降级处理方法");
        return false;
    }


    public boolean removeDepartById(int id) {
        System.out.println("执行feigndelDepartById()的服务降级处理方法");
        return false;
    }


    @Override
    public boolean modifyDepart(Depart depart) {
        System.out.println("执行feignmodifyDepart()的服务降级处理方法");
        return false;
    }

    @Override public Depart getDepartById(int id) {
        System.out.println("执行feigngetDepartById()的服务降级处理方法");
        Depart depart = new Depart();
        depart.setId(0);
        depart.setName("执行feigngetDepartById()的服务降级处理方法");
        return depart;
    }

    @Override
    public Depart getSlowHandle(int id) {
        System.out.println("执行feigngetDepartById(slow)的服务降级处理方法");
        Depart depart = new Depart();
        depart.setId(0);
        depart.setName("执行feigngetDepartById(slow)的服务降级处理方法");
        return depart;
    }

    @Override public List<Depart> listAllDeparts() {
        System.out.println("执行feignlistAllDeparts()的服务降级处理方法");
        return null;
    }
}
